package com.kordar.admin.modular.sys.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kordar.admin.modular.sys.entity.DictTypeEntity;
import com.kordar.admin.modular.sys.mapper.DictTypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@DS("#kordardb")
public class DictTypeServiceImpl extends ServiceImpl<DictTypeMapper, DictTypeEntity> implements DictTypeService {

    DictTypeMapper dictTypeMapper;

    @Autowired
    public void setMenuMapper(DictTypeMapper dictTypeMapper) {
        this.dictTypeMapper = dictTypeMapper;
    }

    @Override
    public boolean hasExists(String field, Object object) {
        QueryWrapper<DictTypeEntity> query = new QueryWrapper<>();
        query.eq(field, object);
        return getOne(query, false) != null;
    }
}
